<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon" href="../../docs/image3D.png">
    <script src="../../build/image3D.js"></script>
    <title>着色器 | 测试</title>

    <!-- 顶点着色器 -->
    <script type='x-shader/x-vertex' id='vs'>
        void main(){
            gl_Position=vec4(0.0,0.0,0.0,1.0);
            gl_PointSize=100.0;
        }
    </script>

    <!-- 片段着色器 -->
    <script type='x-shader/x-fragment' id='fs'>
        void main(){
            gl_FragColor=vec4(1.0,0.0,0.0,1.0);
        }
    </script>

</head>

<body>

    <h2>
        Tips:你应该看见一个位于中心的100*100的红色正方形！
    </h2>

    <canvas width=200 height=200>非常抱歉，您的浏览器不支持canvas!</canvas>

    <script>

        var core = image3D.core(document.getElementsByTagName('canvas')[0]);

        // 启用着色器
        core.shader(
            document.getElementById('vs').innerHTML,
            document.getElementById('fs').innerHTML
        );

        // 获取画笔
        var painter = core.painter();

        // 绘制一个点
        painter.points(0, 1);

    </script>

</body>

</html>
